#!/bin/bash

# 生成私钥
openssl genrsa -out /root/private.key 2048

read

# 生成证书（非交互模式）
openssl req -newkey rsa:2048-nodes -keyout /root/private.key -x509 -days 365 -out /root/cert.crt

read

# 安装Nginx（如果未安装）
if ! command -v nginx &> /dev/null; then
  apt-get update >/dev/null
  apt-get install -y nginx >/dev/null
fi

# 配置Nginx
cat >> /etc/nginx/nginx.conf << 'EOF'

server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate /root/cert.crt;
    ssl_certificate_key /root/private.key;
}
EOF

# 重启Nginx
nginx -t && systemctl restart nginx

echo "完成！"
echo "私钥路径：/root/private.key"
echo "证书路径：/root/cert.crt"
#7.1
#ip.src==172.17.0.1 and ip.dst == 172.17.0.2 and http

#找到Length为716的包后缀带有/admin/login.php

#7.2
#ip.src==172.17.0.2 and ip.dst == 172.17.0.1 and http

#找到Length为309的包

#7.3
#在Length为309的包里右键打开追踪流，找到日期并截图

ensp的题目
4.1
sw2:
acl 2002
 ru 0 pe so 1.1.2.0 0.0.0.255

4.2
sw2:
acl 3002
 ru 0 pe tcp so 192.168.201.0 0.0.0.255 de 192.168.100.0 0.0.0.255 de eq 23

4.3
sw2:
acl 3002
 ru 1 de tcp so 192.168.202.0 0.0.0.255 de 192.168.100.0 0.0.0.255 de eq 80

4.4 
sw2:
user-in vty 0 4
    acl 2002 in
    int g0/0/2
　　　tr ou acl 3002

第六题
编辑 /etc/apache2/apache2.conf 
vi /etc/apache2/apache2.conf 
找到项目
Timeout 300 -> Timeout 500
6.2
LogLevel crit

第8题
8.1
192.168.221.214
8.2
2023/3/23:18:16:04
8.3
manager
8.4
check.sh